Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

CU-864dtwgww - Add a way to give hints when parsing #1

Merged
merged 2 commits into from
Mar 16, 2023
Merged

Conversation

luc10921
Copy link

Neo3-parse needs to be deployed and then Neon-parse needs to import the dependency

@luc10921 luc10921 requested a review from melanke March 15, 2023 19:04
]

// Call parseRpcResponse on an item of the stack
const response = Neo3Parser.parseRpcResponde(stackResult[0])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you put parseRpcResponde with the D instead of S by mistake in several places 😅


## How to parse responses

After invoking a contract you'll get the results on a stack. Use the `parseRpcResponse(field: RpcResponse, parseConfig?: ParseConfig)` function on each item to get the results parsed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by "on each item"? It sounds like if I have multiple variables on my response I will need to do this for each of them, and this is not true, I can do this once for my response and it will parse everything.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I meant each item inside the result stack, e.g., if I invoked 3 methods on the same transaction, then the result stack would have length 3 and I would need to call parseRpcResponse 3 times.

I could overload the function and have a function parseRpcResponse(field: RpcResponse, parseConfig?: ParseConfig): any and a function parseRpcResponse(field: RpcResponse[], parseConfig?: ParseConfig[]): any[] if you prefer

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the majority of the use cases the user will invoke a single method on the transaction, so I think this overload is not necessary. I am just concern with the understanding. IDK, maybe saying "each item of the stack" might be enought to clarify.

@luc10921 luc10921 requested a review from melanke March 16, 2023 19:23
@melanke melanke merged commit 0ae4ab4 into master Mar 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants